package com.gxa.admin.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.gxa.service.OrderListRpcDto;

import com.gxa.Vo.OrderlistRpcVo;
import com.gxa.admin.mapper.OrderListMapper;
import com.gxa.service.OrderListRpcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Author：lizhijun
 * @Package：{PROJECT_NAME}
 * @name：{DATE} {NAME}
 */
//前台订单远程调用
@Service
@Slf4j
public class OrderListRpcServiceImpl implements OrderListRpcService {
    @Autowired
    private OrderListMapper orderListMapper;
    //@Transactional(rollbackFor = Exception.class)
    @Override
    public int addOrderList(OrderListRpcDto orderListRpcDto) {
        log.info("进入远程调用{}",orderListRpcDto);
        return this.orderListMapper.addOrderList(orderListRpcDto);
    }

    @Override
    public OrderlistRpcVo getOrderList(String orderId) {
        return this.orderListMapper.findOrderById(orderId);
    }

    @Override
    public List<OrderlistRpcVo> findOrderList(Integer userId, String orderType) {
        List<OrderlistRpcVo> result = orderListMapper.findAllOderListByUserId(userId,orderType);
        return result;
    }

    @Override
    public List<OrderlistRpcVo> findOrderList() {
        List<OrderlistRpcVo> result = orderListMapper.findAllOderListByUserId();
        return result;
    }

    @Override
    public int updateOrder(OrderListRpcDto orderListRpcDto) {
        log.info("进入远程调用{}",orderListRpcDto);
        return orderListMapper.updateOrderStatus(orderListRpcDto);

    }


}
